/**
 * Copyright (C), 2015-2019, XXX有限公司
 * FileName: PageBean
 * Author:   步步为莹
 * Date:     2019/8/17 22:00
 * Description: 分页基本类
 * History:
 */
package cn.beyond.vehicleManagement.util;

import java.util.ArrayList;
import java.util.List;

/**
 * 〈分页基本类〉<br> 
 * 〈一句话功能简述〉
 *
 * @author 步步为莹
 * @create 2019/8/17
 * @since 1.0.0
 */
public class PageBean<T> {
    //分页的集合
    private List<T>pageList=new ArrayList<>();
    private int totalPage;//总页数
    private int pageNow;//当前页数
    private int pageSize;//每页数
    private int totalRow;//总页数
    private int firstPage;//首页
    private int lastPage;//末页
    private int prePage;//上一页
    private int nextPage;//下一页
    private String prePageURL;//上一页URL
    private String nextPageURL;//下一页URL
    private  int startRow;//开始行
    private  int endRow;//结束行
    private  int PageNowCount;//本页多少行

    public List<T> getPageList() {
        return pageList;
    }

    public void setPageList(List<T> pageList) {
        this.pageList = pageList;
    }

    public int getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public int getPageNow() {
        return pageNow;
    }

    public void setPageNow(int pageNow) {
        this.pageNow = pageNow;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalRow() {
        return totalRow;
    }

    public void setTotalRow(int totalRow) {
        this.totalRow = totalRow;
    }

    public int getFirstPage() {
        return firstPage;
    }

    public void setFirstPage(int firstPage) {
        this.firstPage = firstPage;
    }

    public int getLastPage() {
        return lastPage;
    }

    public void setLastPage(int lastPage) {
        this.lastPage = lastPage;
    }

    public int getPrePage() {
        return prePage;
    }

    public void setPrePage(int prePage) {
        this.prePage = prePage;
    }

    public int getNextPage() {
        return nextPage;
    }

    public void setNextPage(int nextPage) {
        this.nextPage = nextPage;
    }

    public String getPrePageURL() {
        return prePageURL;
    }

    public void setPrePageURL(String prePageURL) {
        this.prePageURL = prePageURL;
    }

    public String getNextPageURL() {
        return nextPageURL;
    }

    public void setNextPageURL(String nextPageURL) {
        this.nextPageURL = nextPageURL;
    }

    public int getStartRow() {
        return startRow;
    }

    public void setStartRow(int startRow) {
        this.startRow = startRow;
    }

    public int getEndRow() {
        return endRow;
    }

    public void setEndRow(int endRow) {
        this.endRow = endRow;
    }

    public int getPageNowCount() {
        return PageNowCount;
    }

    public void setPageNowCount(int PageNowCount) {
        this.PageNowCount = PageNowCount;
    }

    public PageBean(List<T> pageList, int pageNow, int pageSize, int totalRow) {
        this.PageNowCount=pageList.size();
        this.startRow=(pageNow-1)*pageSize+1;
        this.endRow=startRow+PageNowCount-1;
        totalPage=totalRow%pageSize==0?totalRow/pageSize:totalRow/pageSize+1;
        this.pageList = pageList;
        this.pageNow = pageNow;
        this.pageSize = pageSize;
        this.totalRow = totalRow;
    }

    @Override
    public String toString() {
        return "PageBean{" +
                "pageList=" + pageList +
                ", totalPage=" + totalPage +
                ", pageNow=" + pageNow +
                ", pageSize=" + pageSize +
                ", totalRow=" + totalRow +
                ", firstPage=" + firstPage +
                ", lastPage=" + lastPage +
                ", prePage=" + prePage +
                ", nextPage=" + nextPage +
                ", prePageURL='" + prePageURL + '\'' +
                ", nextPageURL='" + nextPageURL + '\'' +
                ", startRow=" + startRow +
                ", endRow=" + endRow +
                ", PageNowCount=" + PageNowCount +
                '}';
    }
}